<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: legion
  Date: 2021/10/15
  Time: 20:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加</title>
    <script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
    <link rel="stylesheet" href="/resource/css/index3.css">
</head>
<body>

<form action="add" method="post">
    学生姓名:<input type="text" name="name">
    性别:<input type="radio" name="gender" checked="checked" value="0">男
        <input type="radio" name="gender" value="1">女
        <br>
    出生日期:<input type="date" name="birthday">
    联系电话:<input type="text" name="phone"><br>

    专业:<select name="majorid">
    <option value="">--请选择--</option>
    <c:forEach items="${list}" var="m">
        <option value="${m.id}" }>${m.name}</option>
    </c:forEach>
</select>

    <br>

    住宿费:<input type="text" name="accommodation">
    报名费:<input type="text" name="applyfee">
    <br>
    <input type="button" value="保存" onclick="add()">
</form>
<script >
    function add() {
        $.post("add",$("form").serialize(),function (result) {
            if (result){
                alert("保存成功")
                location="list";
            }else {
                alert("保存失败")
            }
        })
    }
</script>
</body>
</html>
